package cn.xiyue.production.network;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class HttpRequest{
    private static Retrofit retrofit;
    
    public static Retrofit getRetrofit() {
        if (retrofit==null){
            OkHttpClient okHttpClient = new OkHttpClient.Builder()
                    .build();
            retrofit = new Retrofit.Builder()
                    .baseUrl(RequestApi.baseUrl)
                    .addConverterFactory(GsonConverterFactory.create())
                    .client(okHttpClient)
                    .build();
        }
        return retrofit;
    }

    public static RequestApi getRequestApi(){
        return getRetrofit().create(RequestApi.class);
    }
}
